/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.barrientosjunior.massfilerenamer.util;

import java.io.File;
import java.io.FileFilter;

/**
 *
 * @author Junior
 */
public class UserFileFilter implements FileFilter{

    String filter = "";

    public UserFileFilter(String filter) {
        this.filter = filter;
    }

    /**
     * Tests if the file is name is under the file filter conditions.
     * @param file
     * @return boolean
     */
    public boolean accept(File file) {
        boolean accepted = false;
        if (file.isDirectory())
            return false;
        else if (!"".equals(filter)){
            /* TODO: implement filter string */
            if (file.getName().toLowerCase().endsWith(filter)){
                accepted = true;
            }
        }

        return accepted;
    }

}
